<?php

/*
 * This file is part of PHP CS Fixer.
 *
 * (c) wangyt <wangtom365@gmail.com>
 *
 * This source file is subject to the MIT license that is bundled
 * with this source code in the file LICENSE.
 */

namespace App\Http\Controllers\Admins;

use App\Models\CategoryModel;
use App\Models\LinkModel;
use App\Models\Post\PostModel;
use App\Models\UserModel;
use Illuminate\Http\Request;

class DashboardController extends AdminController
{
    /**
     * 详情.
     *
     * @return \Illuminate\View\View
     */
    public function index(Request $request)
    {
        $data = [];
        $data['LinkCount'] = LinkModel::where('status', 1)->count();
        $data['PostCount'] = PostModel::where('status', 1)->count();
        $data['CategoryCount'] = CategoryModel::where('status', 1)->count();
        $data['UserCount'] = UserModel::where('id', '>=', 1)->count();

        return view('admins.dashboard', $data);
    }
}
